<div class="admin">
    <div class="tab panel dux-box admin-panel">
        <div class="panel-head"><strong>已上架商品</strong></div>
        <div class="fixed-empty"></div>
        <form method="post" action="{:U('index')}" name="formSearch" id="formSearch">
        <table class="table tb-type2">
            <tbody>
                <tr>
                    <td width="8%"><label style="font-weight: bold;">商品名称：</label></td>
                    <td width="20%"><input class="input" type="text" name="goods_title" value="" /></td>
                    <td width="5%"><label style="font-weight: bold;">店铺：</label></td>
                    <td width="20%"><input class="input" type="text" name="store_name" value="" /></td>
                    <td width="10%"><button class="button bg-blue" type="submit">查询</button></td>
                    <td width="*"></td>
                </tr>
            </tbody>
        </table>
        </form>

        <table class="table tb-type2 nobdb">
            <thead>
                <tr class="thead">
                    <th>序号</th>
                    <th width="4%">图片</th>
                    <th>商品名称</th>
                    <th>店铺</th>
                    <th width="5%">进货价</th>
                    <th width="4%">销售价</th>
                    <th width="4%">市场价</th>
                    <th width="4%">销量</th>
                    <th width="4%">浏览</th>
                    <th width="6%">推荐</th>
                    <th width="20%">操作</th>
                </tr>
            </thead>
            <tbody>
            <foreach  name="res" item="vo" key="key">
                <tr class="hover" style="background: rgb(255, 255, 255);">
                    <td class="oGoods">{$vo['goods_id']}</td>
                    <td><img src="{$vo['goods_thumb']}!100x100" height="24" width="24" /></td>
                    <td><a href="{:HOME_URL}/Goods/{$vo['goods_id']}" target="_blank">{$vo['goods_title']}</a></td>
                    <td>{$vo['store_name']}</td>
                    <td>{$vo['goods_stockprice']}</td>
                    <td>{$vo['goods_price']}</td>
                    <td>{$vo['goods_markprice']}</td>
                    <td>{$vo['goods_id']|goodsRealsale}</td>
                    <td>{$vo['goods_hits']}</td>
                    <td>
                    <if condition="$vo['goods_is_index'] eq 1">
                        <a class="button bg-green button-little" href="javascript:(0)" data="1" title="已推荐/点击取消" onclick="tuijian({$vo['goods_id']},'已推荐，确认取消此商品顶置吗？')"><i class="icon-thumbs-up"></i>置顶</a>
                        <else />
                        <a class="button bg-gray button-little" href="javascript:(0)" data="1" title="未置顶/点击推荐" onclick="tuijian({$vo['goods_id']},'未置顶，确认顶置此商品')"><i class="icon-thumbs-up"></i>置顶</a>
                    </if>
                    </td>
                <td class="w144 align-center">
                    <a class="button bg-red button-little" href="javascript:" data="1" title="下架" onclick="xiajia({$vo['goods_id']})"><i class="icon-minus-circle"></i>下架</a>
                    <a class="button bg-red button-little js-del" href="javascript:" data="1" title="下架" onclick="huishou({$vo['goods_id']})"><i class="icon-minus-circle"></i>删除</a>
                    <a class="button bg-blue button-little" href="{:U('/Goods/edit',array('goods_id'=>$vo['goods_id']))}"><i class="icon-edit"></i>编辑</a>
                    <a class="button bg-yellow button-little" href="{:U('/Comment/index',array('goods_id'=>$vo['goods_id']))}"><i class="icon-edit"></i>评论</a>
                </td>
                </tr>
            </foreach>
            </tbody>
            <tfoot class="panel-foot">
                <tr>
                    <td colspan="11"><div class="pages clearfix">{$pages}</div></td>
                </tr>
            </tfoot>
        </table>
    </div>
</div>
<script>
function huishou(dete){
    layer.confirm('确定要放入回收站？',{btn: ['是的', '算了'] },function(){
        dete = {goods_id:dete};
        var p = Aajax("{:ADMIN_URL}{:U('Goods/goods_del_huishou')}", dete);
        if (p.n){
            layer.msg('商品已放入回收站');
            setTimeout("history.go(0)", 1500);
        } else{
            layer.msg('出错请稍后再试');
        }
        }
    );
}
function xiajia(dete){
    layer.confirm('确定要放回下架？',{btn: ['是的', '算了'] },function(){
            dete = {goods_id:dete};
            var p = Aajax("{:ADMIN_URL}{:U('Goods/goods_del_xiajia')}", dete);
            if (p.n){
                layer.msg('商品已入下架');
                setTimeout("history.go(0)", 1500);
            } else{
                layer.msg('出错请稍后再试');
            }
        }
    );
}
function tuijian(dete,title){
    layer.confirm(title,{btn: ['是的', '算了'] },function(){
            dete = {goods_id:dete};
            var p = Aajax("{:ADMIN_URL}{:U('Goods/goods_del_tuijian')}", dete);
            if (p.n){
                layer.msg('操作成功');
                setTimeout("history.go(0)", 1000);
            } else{
                layer.msg('出错请稍后再试');
            }
        }
    );
}
</script>